# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-libmagic
pkgname=('python2-libmagic' 'python-libmagic')
_pkgname=libmagic
pkgver=1.0
pkgrel=7
pkgdesc='Libmagic bindings.'
arch=('any')
url='https://pypi.org/project/libmagic/#files'
license=('GPL' 'GPL3')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('7dee090d5115e2f0c82cf4b2923513a8ec345cd6a88832add485766a626faba91a0d7d1571f87b912349c6a02a8e9b02e43a4adb5389f3b96edb3e80c86ccce3')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-libmagic() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-libmagic() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

